<?php
use Application\Model\vn3dUtil;
?>
<style>
#vn3d-view-product img {
	height: 92px !important;
	width: 212px !important;
	margin-top: 10px;
	margin-left: 12px;
	margin-right: 12px;
}
.vn3d-img, .vn3d-desc, .vn3d-cart{
	padding: 0px!important;
	word-wrap:break-word;
}
.vn3d-desc{
}
</style>
<script type="text/javascript">

var productID="";
function closeFancybox(){
	$.fancybox.close();
}
function loadAddtocart(){
	$.ajax({
        url: "/store/add-to-cart/"+productID,
        type: "POST",
        dataType:"html",
//	        data: {
//	               order_by:orderby,
//	               order:order,
//	        	   rowperpage:rowperpage,
//	        	   typeView:typeView
//	        	}, //The data your sending to page
        success: function(html){
        $("#inline-addtocart").html(html);
        $("#inline").click();

        setTimeout(function(){closeFancybox(); },3000);


        },
        error:function(){
            console.log("AJAX request was a failure");
        }
      });
}
$(document).ready(function(){

	$(".btn-link-addtocart").click(function(){
		productID=$(this).attr("product");
		loadAddtocart();
	});




      $(document).on("click","#vn3d-continuous",function(){
    	  closeFancybox();
          });


});

</script>
<div id="vn3d-view-product">
<?php

foreach ($paginator as $key => $product) {
    ?>
    <div style="width: 100%">
    <div class="vn3d-img col-md-4">

    <?php echo vn3dUtil::getBannerProductLink($product);?>
    </div>
    <div class="vn3d-desc col-md-6">

    <h4><?php echo $product->name;?></h4>
    <p><?php echo $product->short_desc;?></p>
    </div>
    <div class="vn3d-cart col-md-2">
        <span class="text-primary" style="font-size: large;">$<?php echo $product->price;?>.00</span><br>
		<span class="text-muted">CODE: <?php echo $product->code;?></span> <hr>
		<small>ADD TO WISH LIST</small>
		<button type="button" class="btn btn-xs btn-danger  btn-link-addtocart"
						product="<?php echo $product->id;?>">ADD TO CART</button>

    </div>

    </div>
    <?php
}
?>
</div>
<center>
<?php

	echo $this->paginationControl ( $paginator, 'Sliding', '/layout/ProductPaginator.phtml', array (
			'action' => $action,
            'route' => $route,
			'order_by' => $order_by,
			'order' => $order,
            'groupProductID'=>$groupProductID,
'urlSeo'=>vn3dUtil::convertUrlSeo($groupProduct->name)
	) );
	?>
</center>

<a id="inline" href="#inline-addtocart" style="display: none;">add to cart</a>
<div style="display: none;" id="inline-addtocart">add to cart</div>